package com.example.skytakeoutserver.config.cpn.task

import com.example.serverbase.ext.Log
import com.example.skytakeoutserver.service.OrderService
import lombok.RequiredArgsConstructor
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Component
import java.time.Instant

@Component
@RequiredArgsConstructor
class OrderNotifyTask(
    val orderService: OrderService,
) {
    /**
     * 处理超时订单的方法
     * 每分钟执行一次
     */
    @Scheduled(cron = "0 * * * * ?")
    fun processTimeoutOrder() {

    }

    /**
     * 处理超时订单的方法
     * 每天凌晨1点执行
     */
    @Scheduled(cron = "0 0 1 * * ?")
    fun processDeliveryOrder() {
        Log.info("定时处理配送中的订单: {}", Instant.now())

        val time = Instant.now().plusSeconds(-15 * 60)

        // 使用service
    }
}